function getCookie(name) {
    var arr = document.cookie.split('; ')
    var obj = {}
    // console.log(arr)
    arr.forEach(ele => {
        // console.log(ele.split('='))
        var name = ele.split('=')[0]
        var value = ele.split('=')[1]

        obj[name] = value
    })
    // console.log(obj.id)
    return obj[name]
}

function setCookie(name, value, day) {
    var date = new Date()
    date.setDate(date.getDate() + day)
    document.cookie = `${name}=${value}; expires=${date}`
}

function removeCookie(name) {
    setCookie(name, 1, -1)
}